// 百家号视频数据服务
export const mockBaijiahaoData = {
  // 视频列表数据
  videos: [
    {
      id: 'bjh123456789',  // 百家号视频ID
      itemId: '1789654321',  // 百家号特有的itemId字段
      title: '百家号精选：美食制作教程',
      cover: 'https://picsum.photos/id/238/640/360',  // 使用直接图片URL
      videoUrl: 'https://aigc-files.bigmodel.cn/api/cogvideo/927c8f92-71ed-11f0-9a73-0e3f78bb420c_1.mp4',  // 使用直接视频URL
      embedUrl: 'https://baijiahao.baidu.com/embed/video/1789654321',
      author: {
        id: 'baijia_user123',
        name: '美食家小李',
        avatar: '/src/assets/images/avatar/5.jpg',
        verified: true,
        followers: '98.7万'
      },
      stats: {
        views: '289.3万',
        likes: '15.6万',
        comments: '2876',
        shares: '1.8万',
        collects: '3.9万'
      },
      tags: ['美食', '教程', '家常菜'],
      description: '详细的家常菜制作教程，简单易学，让你秒变厨房达人！#美食教程 #家常菜',
      duration: '4:20',
      publishTime: '2024-03-21 09:30:00',
      status: 'normal'
    },
    {
      id: 'bjh987654321',
      itemId: '1678954321',
      title: '旅行日记：探索神秘古镇',
      cover: 'https://picsum.photos/id/241/640/360',  // 更新为直接图片URL
      videoUrl: 'https://aigc-files.bigmodel.cn/api/cogvideo/927c8f92-71ed-11f0-9a73-0e3f78bb420c_4.mp4',  // 更新为直接视频URL
      embedUrl: 'https://baijiahao.baidu.com/embed/video/1678954321',
      author: {
        id: 'travel_explorer',
        name: '旅行探险家',
        avatar: '/src/assets/images/avatar/6.jpg',
        verified: true,
        followers: '176.3万'
      },
      stats: {
        views: '345.8万',
        likes: '21.4万',
        comments: '4123',
        shares: '2.5万',
        collects: '5.2万'
      },
      tags: ['旅行', '古镇', '探索'],
      description: '带你探索隐藏在大山深处的神秘古镇，感受传统文化的魅力！#旅行 #古镇',
      duration: '6:15',
      publishTime: '2024-03-20 14:10:00',
      status: 'normal'
    }
  ],

  // 获取视频列表
  getVideoList() {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve({
          list: this.videos,
          total: this.videos.length
        })
      }, 300)
    })
  },

  // 获取视频详情
  getVideoDetail(id) {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        const video = this.videos.find((v) => v.id === id)
        if (video) {
          resolve(video)
        } else {
          reject(new Error('视频不存在'))
        }
      }, 200)
    })
  },

  // 获取视频统计数据
  getVideoStats(id) {
    return new Promise((resolve) => {
      setTimeout(() => {
        const video = this.videos.find((v) => v.id === id)
        if (video) {
          // 模拟实时数据变化
          const randomIncrease = (num) => {
            const base = parseInt(num.replace(/[^\d]/g, ''))
            return base + Math.floor(Math.random() * 100)
          }

          resolve({
            ...video.stats,
            views: randomIncrease(video.stats.views),
            likes: randomIncrease(video.stats.likes),
            comments: randomIncrease(video.stats.comments)
          })
        } else {
          resolve({})
        }
      }, 200)
    })
  },

  // 获取视频播放URL
  getVideoUrl(video) {
    return video.embedUrl || video.videoUrl
  }
}